利用索引運算子[]可以取得字串中的字元,如下。
>>>s = "Python程式設計" >>>s[3] h
也可使用片段運算子來指定範圍索引,如下。
>>>s = "Python程式設計" >>>s[2:4] #不包含第四字元(只索引2~3字元) th
Copyright © All rights reserved | This template is made with by Colorlib